﻿<UserControl
    x:Class="CodeShow.CS.CodeShowControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CodeShow.CS"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
   
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition x:Name="ColumnZero" Width="0.2*" />
            <ColumnDefinition x:Name="ColumnOne" MinWidth="350"  />
            <ColumnDefinition x:Name="ColumnTwo" MinWidth="350" />
            <ColumnDefinition x:Name="ColumnThree" MinWidth="450" />
            <ColumnDefinition MinWidth="30" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition x:Name="RowZero" Height="*" />
            <RowDefinition x:Name="RowOne" Height="0" />
            <RowDefinition x:Name="RowTwo" Height="0" />
        </Grid.RowDefinitions>
        <Grid x:Name="xamlViewer" Grid.Column="1" Margin="10">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <TextBlock Grid.Row="0"  x:Name="XamlTitle" Text="XAML" FontSize="30" Foreground="Blue" Margin="50,10,10,0" HorizontalAlignment="Center" />
            <Border Grid.Row="1" BorderBrush="{Binding Foreground, ElementName=XamlTitle}" BorderThickness="2" Margin="0,0,0,30" Padding="10">
                <ScrollViewer ZoomMode="Disabled">
                    <RichTextBlock x:Name="xamlRichTextBlock" Margin="0,0,10,0" >
                    </RichTextBlock>
                </ScrollViewer>
            </Border>
        </Grid>
        <Grid x:Name="csViewer" Grid.Column="2" Margin="10">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <TextBlock Grid.Row="0" x:Name="csTitle" Text="C#" FontSize="30" Foreground="DarkRed" Margin="0,10,10,0" HorizontalAlignment="Center" />
            <Border Grid.Row="1" BorderBrush="{Binding Foreground, ElementName=csTitle}" BorderThickness="2" Margin="0,0,0,30" Padding="10">
                <ScrollViewer Margin="10,0,0,0" ZoomMode="Disabled">
                    <RichTextBlock x:Name="csRichTextBlock">
                    </RichTextBlock>
                </ScrollViewer> 
            </Border>
        </Grid>
        <Grid x:Name="controlGrid" Grid.Column="3">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <TextBlock Grid.Row="0" Text="Demo" FontSize="30" Foreground="DarkRed" Margin="5,10,10,0" HorizontalAlignment="Center" />
            <Grid Grid.Row="1" x:Name="control" Margin="10" VerticalAlignment="Top" />
        </Grid>
        
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="Landscape">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColumnOne" Storyboard.TargetProperty="Width">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="4*"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColumnTwo" Storyboard.TargetProperty="Width">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="4*"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColumnThree" Storyboard.TargetProperty="Width">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="5*"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RowZero" Storyboard.TargetProperty="Height">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="*"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RowOne" Storyboard.TargetProperty="Height">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="0"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RowTwo" Storyboard.TargetProperty="Height">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="0"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Portrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColumnOne" Storyboard.TargetProperty="Width">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="*"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColumnTwo" Storyboard.TargetProperty="Width">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="0"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColumnThree" Storyboard.TargetProperty="Width">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="0"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RowZero" Storyboard.TargetProperty="Height">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="auto"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RowOne" Storyboard.TargetProperty="Height">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="auto"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RowTwo" Storyboard.TargetProperty="Height">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="auto"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</UserControl>
